import state from './state.js'
//import state from './mutations.js'
export default{
	total(state){
		let c=0
		state.carts.forEach(x=>c+=x.goods_count)
		return c
	},
	checkedCount(state){
		return state.carts.filter(x=>x.goods_state).reduce((total,item)=>total+=item.goods_count,0)
	},
	checkedState(state){
		let a=true
		state.carts.forEach(x=>{
			if(x.goods_state===false){
				a=false
			}
		})
		return a
	},
	checkedGoodsAmount(state){
		return state.carts.filter(x=>x.goods_state).reduce((total,item)=>total+=item.goods_count*item.goods_price,0).toFixed(2)
	}
}